package org.wk.upms.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wk.upms.dao.RoleResourceDao;
import org.wk.upms.domain.RoleResourceEntity;

import java.util.ArrayList;
import java.util.List;

@Service
public class RoleResourceServiceImpl implements RoleResourceService{
    @Autowired
    private RoleResourceDao roleResourceDao;

    /**
     * 查询角色拥有的功能权限
     * @param roleId
     * @return
     */
    @Override
    public List<String> queryMenuIdList(String roleId) {
        List<RoleResourceEntity> roleResourceEntities = roleResourceDao.findByRoleId(roleId);
        List<String> resData = new ArrayList<>();
        for (RoleResourceEntity entity: roleResourceEntities) {
            resData.add(entity.getResourceId());
        }
        return resData;
    }
}
